Is Operator

Compares two object references to determine whether they both refer to the same object.


Syntax

result=object1 Is object2

PartTypeDescription
result Boolean Any container expecting a Boolean value.
object1 Object Any object name.
object2 Object Another object name.


Notes

The Is operator returns True if object1 and object2 actually refer to the same object. It checks identity, not contents, so it is not affected by the presence of a comparison operator. Use it the same way as the = operator.


Example

In the following example, the Is operator returns True.

Dim w1,w2 as Window
w1=Window1
w2=Window1
If w1 Is w2 then
//do something here
Else
//do something else here
End if

See Also

IsA operator.